<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActionView::Helpers::RecordTagHelper</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActionView::Helpers::RecordTagHelper</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/rails/actionpack/lib/action_view/helpers/record_tag_helper_rb.html">
                vendor/rails/actionpack/lib/action_view/helpers/record_tag_helper.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M002019">content_tag_for</a>&nbsp;&nbsp;
      <a href="#M002018">div_for</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M002019" class="method-detail">
        <a name="M002019"></a>

        <div class="method-heading">
          <a href="#M002019" class="method-signature">
          <span class="method-name">content_tag_for</span><span class="method-args">(tag_name, record, *args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
<a href="RecordTagHelper.html#M002019">content_tag_for</a> creates an HTML
element with id and class parameters that relate to the specified Active
Record object. For example:
</p>
<pre>
   &lt;% content_tag_for(:tr, @person) do %&gt;
     &lt;td&gt;&lt;%=h @person.first_name %&gt;&lt;/td&gt;
     &lt;td&gt;&lt;%=h @person.last_name %&gt;&lt;/td&gt;
   &lt;% end %&gt;
</pre>
<p>
would produce the following HTML (assuming @person is an instance of a
Person object, with an id value of 123):
</p>
<pre>
   &lt;tr id=&quot;person_123&quot; class=&quot;person&quot;&gt;....&lt;/tr&gt;
</pre>
<p>
If you require the HTML id attribute to have a prefix, you can specify it:
</p>
<pre>
   &lt;% content_tag_for(:tr, @person, :foo) do %&gt; ...
</pre>
<p>
produces:
</p>
<pre>
   &lt;tr id=&quot;foo_person_123&quot; class=&quot;person&quot;&gt;...
</pre>
<p>
<a href="RecordTagHelper.html#M002019">content_tag_for</a> also accepts a
hash of options, which will be converted to additional HTML attributes. If
you specify a <tt>:class</tt> value, it will be combined with the default
class name for your object. For example:
</p>
<pre>
   &lt;% content_tag_for(:li, @person, :class =&gt; &quot;bar&quot;) %&gt;...
</pre>
<p>
produces:
</p>
<pre>
   &lt;li id=&quot;person_123&quot; class=&quot;person bar&quot;&gt;...
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M002019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M002019-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_view/helpers/record_tag_helper.rb, line 50</span>
50:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_tag_for</span>(<span class="ruby-identifier">tag_name</span>, <span class="ruby-identifier">record</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
51:         <span class="ruby-identifier">prefix</span>  = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span>
52:         <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
53:         <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge!</span>({ <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{dom_class(record)} #{options[:class]}&quot;</span>.<span class="ruby-identifier">strip</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">dom_id</span>(<span class="ruby-identifier">record</span>, <span class="ruby-identifier">prefix</span>) })
54:         <span class="ruby-identifier">content_tag</span>(<span class="ruby-identifier">tag_name</span>, <span class="ruby-identifier">options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
55:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M002018" class="method-detail">
        <a name="M002018"></a>

        <div class="method-heading">
          <a href="#M002018" class="method-signature">
          <span class="method-name">div_for</span><span class="method-args">(record, *args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Produces a wrapper DIV element with id and class parameters that relate to
the specified Active Record object. Usage example:
</p>
<pre>
   &lt;% div_for(@person, :class =&gt; &quot;foo&quot;) do %&gt;
      &lt;%=h @person.name %&gt;
   &lt;% end %&gt;
</pre>
<p>
produces:
</p>
<pre>
   &lt;div id=&quot;person_123&quot; class=&quot;person foo&quot;&gt; Joe Bloggs &lt;/div&gt;
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M002018-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M002018-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_view/helpers/record_tag_helper.rb, line 15</span>
15:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">div_for</span>(<span class="ruby-identifier">record</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
16:         <span class="ruby-identifier">content_tag_for</span>(<span class="ruby-identifier">:div</span>, <span class="ruby-identifier">record</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
17:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>